package com.kedao.interceptor;

import com.jfinal.aop.Interceptor;
import com.jfinal.core.ActionInvocation;
import com.jfinal.core.Controller;

public class AdminLoginInterceptor implements Interceptor {

	@Override
	public void intercept(ActionInvocation ai) {
		Controller controller = ai.getController();
		if (controller.getSessionAttr("username") != null) {
			ai.invoke();
		} else {
			controller.setAttr("msg", "需要登录才可使用云平台!");
			controller.redirect("/");
		}
	}

}
